package com.taskcollection.util;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by haocongshun on 2016/7/19.
 */
public class DBUtil {
    public static void closeResultSet(ResultSet rs){
        try {
            if(rs==null){

            }else {
                rs.close();
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    public static void closePreparedStatement(PreparedStatement ps){
        try {
            if(ps==null){

            }else {
                ps.close();
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    public static void closeConnection(Connection conn){
        try {
            if (conn==null){

            }else {
                conn.close();
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
